<!DOCTYPE html>
<html lang=“en”>
<head>
<meta charset="UTF-8">
<title>slot</title>
<script src='./vue.js'></script>
<style>
.v-enter,.v-leave-to{
opacity:0;
}
.v-enter-active,.v-leave-active{
transition: opacity 3s;
}
</style>
</head>
<body>
<div id="app">
<transition @before-enter="handlebe" @enter="handlee" @afer-enter="handleae">
<div v-if="show">hello world</div>
</transition>
<button @click="handleclick">切换</button>
</div>
<script>

var vm=new Vue({
el:"#app",
data:{
show:true
},
methods:{
handleclick:function(){
this.show=!this.show;
},
handlebe:function(el){
el.style.color='red'

},
handlee:function(el,done){
setTimeout(()=>{
el.style.color="green"
done
},2000)
},
handleae:function(el){
el.style.color="#0000"}

}
})
</script>
</body>